import KoaRouter from '@koa/router';
import type {
  KoaRoutes,
} from '@/types/koa';

export default (router: KoaRouter, routes: KoaRoutes[]) => {
  routes.forEach(({
    method, path, middleware, controller,
  }) => {
    router[method](path, ...middleware, controller);
  });
};
